package cn.itcast.com.IO.zifuliu.buffer;

import java.io.*;

public class demo01 {
    public static void main(String[] args) throws IOException {
        //创建流对象
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("D:\\代码\\代码\\代码\\cn\\itcast\\com\\IO\\b.txt"));
        BufferedReader bufferedReader = new BufferedReader(new FileReader("D:\\代码\\代码\\代码\\cn\\itcast\\com\\IO\\a.txt"));

        //按行复制文本文件
        String str;
        while ((str = bufferedReader.readLine()) != null){
            //把读取到的一行字符串写入缓冲字符输出流
            bufferedWriter.write(str);
            bufferedWriter.newLine();
        }
        //关闭流并释放资源
        //关闭最上层的包装流即可
        bufferedReader.close();
        bufferedWriter.close();

    }
}
